package com.fwtai.web;

import com.fwtai.bean.PageFormData;
import com.fwtai.datasource.DaoHandle;
import org.springframework.stereotype.Repository;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

/**
 * 商品防伪码访问数据库
 * @作者 田应平
 * @版本 v1.0
 * @创建时间 2024-02-20 12:03:46
 * @QQ号码 444141300
 * @Email service@fwtai.com
 * @官网 <url>http://www.fwtai.com</url>
*/
@Repository
public class GoodsCodeDao{

  private final DaoHandle dao;

  public GoodsCodeDao(final DaoHandle dao){
    this.dao = dao;
  }

  public int addGoodsCode(final ArrayList<HashMap<String,Object>> list){
    return dao.execute("goods_code.addGoodsCode",list);
  }

  public Long queryExistById(final long kid){
    return dao.queryForLong("goods_code.queryExistById",kid);
  }

  public String queryById(final long kid){
    return dao.queryForString("goods_code.queryById",kid);
  }

  public List<HashMap<String,Object>> getListData(final PageFormData formData){
    return dao.queryForListHashMap("goods_code.listData",formData);
  }

  public Integer getListTotal(final PageFormData formData){
    return dao.queryForInteger("goods_code.listTotal",formData);
  }

  public List<HashMap<String,Object>> getGoodsList(){
    return dao.queryForListHashMap("goods_code.getGoodsList");
  }
}